NOTIFY=0

NSHOST=''
NSPORT=''

PORT=15001
NAMESERVICE=0
CLOUDMANAGER=0

START_STOP=1
MANAGER=0

while :; do
    case "$1" in
        -h|--help)
            echo "usage: TODO"
            exit 0
            ;;
        -m|--managerserver)
            MANAGER=1
            shift
            ;;
        --nsport)
            shift
            NSPORT=$1
            shift
            ;;
	--nshost)
            shift
            NSPORT=$1
            shift
            ;;
	--port)
            shift
            PORT=$1
            shift
            ;;
        -*)
            # Unexpected option
            echo $USAGE
            exit 2
            ;;
	start)
	    START_STOP=1
	    shift
	    ;;
	stop)
	    START_STOP=0
	    shift
	    ;;
        *)
            break
            ;;
    esac
done


if [ $MANAGER -eq 1 ] 
then
	APP_OPTS="-port $PORT -ns -cm"
else
	APP_OPTS="-port $PORT -nshost $NSHOST -nsport $NSPORT"
fi

if [ $START_STOP -eq 1 ] 
then
	echo "Service Starting"
	java -jar camid3-0.3.1-SNAPSHOT-jar-with-dependencies.jar $APP_OPTS
else
	echo "Service Stopping"
	killall java
fi


